package com.tech.pattern.iterator;

import java.util.Iterator;

/**
 * @Description:客户端接口
 * @Author: zl
 * @Date: 2019/7/12 14:35
 */
public class Client {

    public static void main(String[] args) {
        Aggregate aggregate = new ConcreteAggregate();
        aggregate.add("a");
        aggregate.add("b");
        aggregate.add("c");

        // 获取迭代器
        Iterator iterator = aggregate.iterator();
        while (iterator.hasNext()) {
            String string = (String) iterator.next();
            System.out.println(string);
        }

    }
}
